package com.malty.mall.service.ums;

import com.baomidou.mybatisplus.extension.service.IService;
import com.malty.mall.domain.dto.req.UmsAdminParam;
import com.malty.mall.domain.entity.ums.UserAdmin;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UsernameNotFoundException;

/**
 * @author malty
 */
public interface IUserAdminService extends IService<UserAdmin> {
    UserDetails loadUserByUsername(String username) throws UsernameNotFoundException;

    UserAdmin register(UmsAdminParam umsAdminParam);

    String login(String username, String password);

    UserAdmin getAdminByUsername(String username);

    /**
     * 关联角色
     *
     * @param uid    用户id
     * @param roleId 角色id
     * @return 管理结果
     */
    Boolean relateRole(Integer uid, Integer roleId);

    /**
     * token刷新
     *
     * @param oldToken token
     * @return 刷新后的token
     */
    String refreshToken(String oldToken);
}
